const cheerio = require('cheerio');
const axios = require('axios');
const puppeteer = require("puppeteer");

let httpUrl = "https://www.doutula.com/article/list/?page=2"


async function test() {
    let browser = await puppeteer.launch({ 
        headless: false,
        defaultViewport:{
            width:1000,
            height:600,
        } 
    })

    // 打开新页面

    let page = await browser.newPage()
    await page.goto(httpUrl)
    await page.screenshot({
        path: '02.jpg'
    })  

    // 获取页面内容
    page.$$eval('#home .col-sm-9>a', elements=>{
     
        elements.forEach(function(item, i){
            console.log({
                href:item.getAttribute("href"),
                text:item.innerText
            })
        })
    })

}

test()